// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "common/refactor/common-refactor.scss" as *;
@use "common/refactor/common-dashboard";

// Dashboard team settings
.dashboard-team-settings {
  display: grid;
  grid-template-rows: auto auto 1fr;
  justify-items: center;
  gap: $s-24;
  width: 100%;
  border-top: $s-1 solid var(--panel-border-color);
  overflow-y: auto;
}

.block {
  display: grid;
  grid-auto-rows: min-content;
  gap: $s-8;
  max-width: $s-1000;
  width: $s-1000;
}

.info-block {
  position: relative;
  padding-top: $s-180;
}

.block-label {
  @include headlineSmallTypography;
  color: var(--title-foreground-color);
}

.block-text {
  color: var(--title-foreground-color-hover);
}

.block-content {
  display: grid;
  grid-template-columns: $s-32 1fr;
  align-items: center;
  gap: $s-12;
}

.owner-icon {
  width: $s-32;
  height: $s-32;
  border-radius: 50%;
}

.user-icon,
.document-icon,
.group-icon {
  @extend .button-icon;
  margin: 0 auto;
  stroke: var(--icon-foreground);
}

.team-icon {
  --update-button-opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: $s-120;
  width: $s-120;
  padding: $s-16;

  &:hover {
    --update-button-opacity: 1;
  }
}

.team-image {
  border-radius: 50%;
  width: $s-120;
  height: $s-120;
}

.update-overlay {
  opacity: var(--update-button-opacity);
  @include buttonStyle;
  @include flexCenter;
  position: absolute;
  top: $s-16;
  left: $s-16;
  height: 100%;
  width: 100%;
  z-index: $z-index-modal;
  border-radius: $br-circle;
  background-color: var(--color-accent-primary);
}

.image-icon {
  @extend .button-icon;
  min-width: $s-24;
  min-height: $s-24;
  stroke: var(--icon-foreground-hover);
}

// TEAM MEMBERS PAGE
.dashboard-team-members {
  display: grid;
  justify-items: center;
  width: 100%;
  height: 100%;
  padding-top: $s-20;
  border-top: $s-1 solid var(--panel-border-color);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.team-members {
  display: grid;
  grid-template-rows: auto 1fr;
  height: fit-content;
  max-width: $s-1000;
  width: $s-1000;
}

.table-header {
  @include headlineSmallTypography;
  display: grid;
  align-items: center;
  grid-template-columns: 43% 1fr $s-108 $s-12;
  height: $s-40;
  width: 100%;
  max-width: $s-1000;
  padding: 0 $s-16;
  user-select: none;
  color: var(--title-foreground-color);
}

.table-rows {
  display: grid;
  grid-auto-rows: $s-64;
  gap: $s-16;
  width: 100%;
  height: 100%;
  max-width: $s-1000;
  margin-top: $s-16;
  color: var(--title-foreground-color);
}

.table-row {
  display: grid;
  grid-template-columns: 43% 1fr auto;
  align-items: center;
  height: $s-64;
  width: 100%;
  padding: 0 $s-16;
  border-radius: $br-8;
  background-color: var(--dashboard-list-background-color);
  color: var(--dashboard-list-foreground-color);
}

.title-field-name {
  width: 43%;
  min-width: $s-300;
}

.title-field-roles {
  position: relative;
  cursor: default;
}

.field-name {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: $s-16;
  width: 43%;
  min-width: $s-300;
}

.field-roles {
  position: relative;
  cursor: default;
}

.field-actions {
  position: relative;
}

// MEMBER INFO
.member-image {
  height: $s-32;
  width: $s-32;
  border-radius: $br-circle;
}

.member-info {
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 100%;
}

.member-name,
.member-email {
  @include textEllipsis;
  @include bodyLargeTypography;
}

.member-email {
  @include bodySmallTypography;
  color: var(--dashboard-list-text-foreground-color);
}

.you {
  color: var(--dashboard-list-text-foreground-color);
  margin-left: $s-6;
}

// ROL INFO
.rol-selector {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  height: $s-32;
  min-width: $s-160;
  width: fit-content;
  padding: $s-4 $s-8;
  border-radius: $br-8;
  border-color: var(--menu-background-color-hover);
  background-color: var(--menu-background-color-hover);
  font-size: $fs-14;
}

.has-priv {
  cursor: pointer;
}

.rol-label {
  user-select: none;
}

.roles-dropdown {
  @extend .menu-dropdown;
  bottom: calc(-1 * $s-76);
  width: fit-content;
  min-width: $s-160;
}

.rol-dropdown-item {
  @extend .menu-item-base;
}

// MEMBER ACTIONS
.menu-icon {
  @extend .button-icon;
  stroke: var(--icon-foreground);
}

.menu-btn {
  @include buttonStyle;
}

.actions-dropdown {
  @extend .menu-dropdown;
  bottom: calc(-1 * $s-32);
  right: 0;
  left: unset;
  width: fit-content;
  min-width: $s-160;
}

.action-dropdown-item {
  @extend .menu-item-base;
}

// TEAM INVITATION PAGE
.dashboard-team-invitations {
  display: grid;
  justify-items: center;
  width: 100%;
  height: 100%;
  padding-top: $s-20;
  border-top: $s-1 solid var(--panel-border-color);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.invitations {
  display: grid;
  grid-template-rows: auto 1fr;
  height: fit-content;
  max-width: $s-1000;
  width: $s-1000;
}

.table-row-invitations {
  grid-template-columns: 43% 1fr $s-108 $s-12;
  align-items: center;
}

.empty-invitations {
  display: grid;
  place-items: center;
  align-content: center;
  height: $s-156;
  max-width: $s-1000;
  width: 100%;
  margin-top: $s-16;
  border: $s-1 solid var(--panel-border-color);
  border-radius: $br-8;
  color: var(--dashboard-list-text-foreground-color);
}

.title-field-status {
  position: relative;
  cursor: default;
}

.field-email {
  @include textEllipsis;
  @include bodyLargeTypography;
  display: grid;
  align-items: center;
}

.invitations-dropdown {
  bottom: calc(-1 * $s-112);
  right: calc(-1 * $s-20);
}

// WEBHOOKS SECTION
.dashboard-team-webhooks {
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  gap: $s-24;
  width: 100%;
  height: 100%;
  padding-top: $s-16;
  border-top: $s-1 solid var(--panel-border-color);
  overflow-y: auto;
}

.webhooks-hero-container {
  display: grid;
  gap: $s-32;
  max-width: $s-1000;
  width: $s-1000;
}

.webhooks-empty {
  display: grid;
  place-items: center;
  align-content: center;
  height: $s-156;
  max-width: $s-1000;
  width: 100%;
  padding: $s-32;
  border: $s-1 solid var(--panel-border-color);
  border-radius: $br-8;
  color: var(--dashboard-list-text-foreground-color);
}

.webhooks-hero {
  font-size: $fs-14;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: $s-32;
  margin-top: $s-32;
  margin: 0;
  padding: $s-32;
  padding: 0;
  width: $s-468;
}

.hero-title {
  @include bigTitleTipography;
  color: var(--dashboard-list-foreground-color);
}

.hero-desc {
  color: var(--color-foreground-secondary);
  margin-bottom: 0;
  font-size: $fs-16;
  max-width: $s-512;
}

.hero-btn {
  @extend .button-primary;
  height: $s-32;
  max-width: $s-512;
}

.webhook-table {
  height: fit-content;
}

.webhook-row {
  display: grid;
  align-items: center;
  grid-template-columns: auto 1fr auto auto;
  gap: $s-16;
}

.actions {
  position: relative;
}

.webhook-actions-dropdown {
  @extend .menu-dropdown;
  right: calc(-1 * $s-16);
  bottom: calc(-1 * $s-40);
  width: fit-content;
  min-width: $s-160;
}

.webhook-dropdown-item {
  @extend .menu-item-base;
}

.success-icon {
  @extend .button-icon;
  stroke: var(--alert-icon-foreground-color-success);
}

.warning-icon {
  @extend .button-icon;
  stroke: var(--alert-icon-foreground-color-warning);
}

// INVITE MEMBERS MODAL
.modal-team-container {
  @extend .modal-container-base;
  @include menuShadow;
  position: fixed;
  top: $s-72;
  right: $s-12;
  left: unset;
  width: $s-400;
  padding: $s-32;
  background-color: var(--modal-background-color);
  &.hero {
    top: $s-216;
    right: $s-32;
  }
}

.modal-title {
  @include headlineMediumTypography;
  height: $s-32;
  color: var(--modal-title-foreground-color);
}

.role-select {
  @include flexColumn;
  row-gap: $s-8;
}

.arrow-icon {
  @extend .button-icon;
  stroke: var(--icon-foreground);
  transform: rotate(90deg);
}

.role-title {
  @include bodyLargeTypography;
  margin: 0;
  color: var(--modal-title-foreground-color);
}

.invitation-row {
  margin-top: $s-8;
  margin-bottom: $s-24;
}

.action-buttons {
  display: flex;
  justify-content: flex-end;
}

.accept-btn {
  @extend .modal-accept-btn;
}

// WEBHOOKS MODAL

.modal-overlay {
  @extend .modal-overlay-base;
}

.modal-container {
  @extend .modal-container-base;
}

.modal-header {
  margin-bottom: $s-24;
}

.modal-title {
  @include uppercaseTitleTipography;
  color: var(--modal-title-foreground-color);
}

.modal-close-btn {
  @extend .modal-close-btn-base;
}

.modal-content {
  @include flexColumn;
  gap: $s-24;
  @include bodySmallTypography;
  margin-bottom: $s-24;
}

.fields-row {
  @include flexColumn;
}

.select-title {
  @include bodySmallTypography;
  color: var(--modal-title-foreground-color);
}

.custom-input-checkbox {
  align-items: flex-start;
}

.hint {
  color: var(--modal-text-foreground-color);
}

.action-buttons {
  @extend .modal-action-btns;
  button {
    @extend .modal-accept-btn;
  }
  .cancel-button {
    @extend .modal-cancel-btn;
  }
}

.email-input {
  @extend .input-base;
  @include bodySmallTypography;
  height: auto;
}
